/**
* 版权声明：厦门睿商网络科技有限公司 版权所有 违者必究
* 日    期：2020-04-07
*/
package com.rzico.basics.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * <pre>
 *   促销数据库对象
 * </pre>
 * @author Rzico Boot
 * @version 1.0
 */
@Data
@JsonIgnoreProperties(value = {"handler"})
@JsonInclude(JsonInclude.Include.NON_NULL)
@Table(name = "wx_promotion")
public class Promotion{

    @Id
    @ApiModelProperty(value = "" )
    protected Long id;

    @ApiModelProperty(value = "创建日期" )
    protected java.util.Date createDate;

    @ApiModelProperty(value = "修改日期" )
    protected java.util.Date modifyDate;

    @ApiModelProperty(value = "开始日期" )
    protected java.util.Date beginDate;

    @ApiModelProperty(value = "结束日期" )
    protected java.util.Date endDate;

    @ApiModelProperty(value = "促销标题" )
    protected String title;

    @ApiModelProperty(value = "促销主图(弹框显示)" )
    protected String thumbnail;

    @ApiModelProperty(value = "促销说明" )
    protected String introduction;

    @ApiModelProperty(value = "促销方式 {0:首页弹屏,1:消费后送,2.扫码领券,3.满减,4.满折,5.满赠,6.满包邮,7.买送,8.秒杀,9.第二件半价,10.新人价,11.买增}" )
    protected Integer type;

    @ApiModelProperty(value = "促销门槛" )
    protected BigDecimal minimumPrice;

    @ApiModelProperty(value = "满折比例" )
    protected BigDecimal agioRate;

    @ApiModelProperty(value = "满减金额/充值金额" )
    protected BigDecimal amount;

    @ApiModelProperty(value = "活动是否跟单品活动叠加" )
    protected Boolean overlying;

    @ApiModelProperty(value = "只适用于首单生效" )
    protected Boolean firsted;

    @ApiModelProperty(value = "优先级" )
    protected Integer orders;

    @ApiModelProperty(value = "赠品类型 {0:礼品,1:优惠券}" )
    protected Integer giftType;

    @ApiModelProperty(value = "审核状态 {0:待审核,1:已审核}" )
    protected Integer status;

    @ApiModelProperty(value = "促销商品" )
    protected Long goodsId;

    @ApiModelProperty(value = "促销库存" )
    protected Integer stock;

    @JsonIgnore
    @ApiModelProperty(value = "是否删除" ,hidden = true )
    protected Boolean deleted;

    @ApiModelProperty(value = "所属企业" )
    protected Long enterpriseId;

    protected Product product;
    /**
     * 当前对象的结果信息
     */
    protected List<PromotionGift> gifts = new ArrayList<PromotionGift>();

    public String getProductName() {
        Product product = getProduct();
        if (product!=null) {
            return product.getName();
        } else {
            return null;
        }
    }

    public void setProductName(String value) {

    }

     public String getProductThumbnail() {
        Product product = getProduct();
        if (product!=null) {
            return product.getThumbnail();
        } else {
            return null;
        }
    }

    public void setProductThumbnail(String value) {

    }

    public BigDecimal getProductPrice() {
        Product product = getProduct();
        if (product!=null) {
            return product.getPrice();
        } else {
            return null;
        }
    }

    public void setProductPrice(String value) {

    }

}
